Skip to content

fix(#234): cache get_next_feed result in GranarySmartFeeder - #247

Open
dennismdejong wants to merge 1 commit into
jjjonesjr33:devfrom
dennismdejong:fix/upstream-234
Open

fix(#234): cache get_next_feed result in GranarySmartFeeder#247
dennismdejong wants to merge 1 commit into
jjjonesjr33:devfrom
dennismdejong:fix/upstream-234

Conversation

@dennismdejong

Copy link
Copy Markdown

Fixes #234

Problem: sensor.granary_smart_feeder_right_next_feed_quantity_volume took 2.284 seconds to update because get_next_feed recomputed timezone-aware datetime math for every feeding plan entry on every call.

Fix: Cache the get_next_feed result for the duration of each refresh cycle. The cache is invalidated at the start of refresh() and the property returns the cached dict on subsequent calls within the same cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant